<template>
  <view class="p-12 bg-white page_min_height">
    <DataLoading v-if="loading" />
    <template v-else>
      <view class="text-base font-bold">{{ detailInfo.title }}</view>
      <view class="flex justify-between mt-8 mb-12">
        <view class="text-blue-500">#{{ detailInfo.type_text }}</view>
        <view class="text-gray-400">{{ detailInfo.updated_at }}</view>
      </view>
      <rich-text class="leading-[1.5]" :nodes="detailInfo.content"></rich-text>
    </template>
  </view>
</template>

<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { getRegulationDetailApi } from '@/api/regulation';

const loading = ref(true);
const detailInfo = ref({});

onLoad(async ({ id }) => {
  const { data } = await getRegulationDetailApi(id);
  loading.value = false;
  detailInfo.value = data;
});
</script>
